package com.cscj.android.repository.network.api.model.shortcut

import androidx.annotation.Keep
import com.cscj.android.repository.db.entity.ShortCutEntryEntity
import com.google.gson.annotations.SerializedName

@Keep
data class ShortCutEntry(
    val id: Int,
    val type: Int,
    val icon: String?,
    @SerializedName("module_name") val name: String?,
    @SerializedName("module_link") val link: String?,
    @SerializedName("is_root") val root: Int
){

    fun isRoot() = root == 1

    fun getFixedName(): String?{
        return when{
            type == ShortCutEntryEntity.EntryTypeFavorites && isRoot() -> "收藏夹"
            type == ShortCutEntryEntity.EntryTypeHistory && isRoot() -> "历史"
            else -> name
        }
    }

}
